package com.xyd.servlet;

import com.xyd.service.ProductSericve;
import com.xyd.service.impl.ProductServiceImpl;
import com.xyd.util.JsonUtil;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 类描述：
 *
 * @author 张吉哲
 * @date 2021/1/11 17:15
 */
@WebServlet("/productAdminDelServlet")
public class ProductAdminDelServlet extends HttpServlet {

  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String epId_str = request.getParameter("epId");
    long epId = Long.parseLong(epId_str);
    ProductSericve productSericve = new ProductServiceImpl();
    boolean flag = productSericve.adminDeleteProductByEpId(epId);

    JsonUtil.toJson(response, flag);
  }

  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    doPost(request, response);
  }
}
